﻿/*
	This file is part of Limpet.

    Limpet is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Limpet is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with Limpet.  If not, see http://www.gnu.org/licenses/.
	
	Copyright 2010 Dan Popick
*/
using System;
using System.Collections.Generic;
using System.Configuration;
using System.ComponentModel;
using System.IO;
using System.Net;
using System.Reflection;
using System.Text;
using System.Web;
using System.Xml;

namespace Open.Web.Diagnostics.Limpet
{
    /// <summary>
    /// Limpet configuration data, including a list of constructor modules
    /// </summary>
    public class LimpetConfig
    {
        /// <summary>
        /// The AES crypto key, encoded with base64
        /// </summary>
        public string Base64AesKey { get; set; }
        /// <summary>
        /// The cookie name which indicates the browser wants Limpet data
        /// </summary>
        public string CookieName { get; set; }
        /// <summary>
        /// The relative URL of the HTTP handler for Limpet details
        /// </summary>
        public string BaseHandlerUrl { get; set; }

        /// <summary>
        /// A list of Limpet modules currently installed
        /// </summary>
        public IList<ILimpetModule> Modules { get; set; }

        /// <summary>
        /// A list of allowed IP addresses. If empty, there are no restrictions.
        /// </summary>
        public IList<IPRestriction> AllowedAddresses { get; set; }

        /// <summary>
        /// Default constructor
        /// </summary>
        public LimpetConfig()
        {
            Modules = new List<ILimpetModule>();
            AllowedAddresses = new List<IPRestriction>();
        }
    }

    /// <summary>
    /// A pair of IPAddresses, indicating a subnet address and a subnet mask.
    /// </summary>
    public class IPRestriction
    {
        /// <summary> The address </summary>
        public IPAddress Address { get; set; }
        /// <summary> The mask </summary>
        public IPAddress Mask { get; set; }
    }
}
